Repository navigation
fix(keystatic): preserve external image URLs in MDX and Markdoc editors (#1625) - #1663
Open
thinhnx128 wants to merge 1 commit into
Open
thinhnx128 wants to merge 1 commit into
thinhnx128 wants to merge 1 commit into
Conversation
…tom TrackedMap deletions Fixes Thinkmill#1625 Signed-off-by: Xuan Thinh Nguyen <thinhnx128@gmail.com>
🦋 Changeset detectedLatest commit: c04e688 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserves external
http:///https://image URLs when parsing, editing, and serializing MDX and Markdoc documents in@keystatic/coreinstead of attempting to load them as local repository blobs.Root Cause
When
fields.mdxorfields.markdocwas configured with an image directory,parseandserializeunconditionally treated all imagesrcattributes as local asset filenames, causing external URLs (https://...) to fail asset lookup and be stripped on save.Changes
packages/keystatic/src/form/fields/markdoc/editor/mdx/parse.ts&serialize.ts: bypass local asset path resolution and preserve externalsrcURLs.packages/keystatic/src/form/fields/markdoc/editor/markdoc/parse.ts&serialize.ts: preserve external imagesrcstrings during Markdoc round-tripping.packages/keystatic/src/form/fields/markdoc/editor/schema.tsx&packages/keystatic/src/app/useItemData.ts: support external URLs in editor image preview and item hydration.packages/keystatic/src/form/fields/markdoc/editor/tests/mdx.test.tsx: add unit test verifying external image URL round-trip in MDX..changeset/fix-mdx-external-image-urls.md: add patch changeset for@keystatic/core.Testing
pnpm --filter @keystatic/core test packages/keystatic/src/form/fields/markdoc/editor/tests/mdx.test.tsxFixes #1625